
import java.util.ArrayList;

public class Student extends Person
{
	@Override
	public String toString()
	{
		return super.toString() + " and I am a student";
	}
	
	private final ArrayList<Grade> grades = new ArrayList<Grade>();
	
	public Student(String name, Data birthday)
	{
		super(name, birthday);
	}
	
	public void addGrade(Grade grade)
	{
		grades.add(grade);
	}
	
	private int totalCredits()
	{
		int totalCredits = 0;
		for(Grade grade : grades)
		{
			totalCredits += grade.getCredit();
		}
		
		return totalCredits;
	}
	
	public boolean canGraduate()
	{
		return totalCredits() >= 180;
	}
	
	public double getWeightedGradeAverage()
	{
		double summWeightedPoint=0;
		for(Grade grade : grades)
		{
			summWeightedPoint += grade.getCredit()+grade.getVote();
		}
		
		return summWeightedPoint;
	}
	
	public int totalCredit()
	{
		int totalCredit=0;
		
		for(Grade grade : grades)
		{
			totalCredit += grade.getCredit();
		}
		
		return totalCredit;
	}
}
